package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PersonHouseMapper;
import com.ruoyi.system.domain.PersonHouse;
import com.ruoyi.system.service.IPersonHouseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 房产信息Service业务层处理
 * 
 * @author TYF
 * @date 2023-08-12
 */
@Service
public class PersonHouseServiceImpl implements IPersonHouseService 
{
    @Autowired
    private PersonHouseMapper personHouseMapper;

    /**
     * 查询房产信息
     * 
     * @param id 房产信息主键
     * @return 房产信息
     */
    @Override
    public PersonHouse selectPersonHouseById(Long id)
    {
        return personHouseMapper.selectPersonHouseById(id);
    }

    /**
     * 查询房产信息列表
     * 
     * @param personHouse 房产信息
     * @return 房产信息
     */
    @Override
    public List<PersonHouse> selectPersonHouseList(PersonHouse personHouse)
    {
        return personHouseMapper.selectPersonHouseList(personHouse);
    }

    /**
     * 新增房产信息
     * 
     * @param personHouse 房产信息
     * @return 结果
     */
    @Override
    public int insertPersonHouse(PersonHouse personHouse)
    {
        personHouse.setCreateTime(DateUtils.getNowDate());
        personHouse.setCreateBy(String.valueOf(ShiroUtils.getSysUser().getUserId()));
        personHouse.setId(System.currentTimeMillis());
        return personHouseMapper.insertPersonHouse(personHouse);
    }

    /**
     * 修改房产信息
     * 
     * @param personHouse 房产信息
     * @return 结果
     */
    @Override
    public int updatePersonHouse(PersonHouse personHouse)
    {
        personHouse.setUpdateTime(DateUtils.getNowDate());
        personHouse.setUpdateBy(String.valueOf(ShiroUtils.getSysUser().getUserId()));
        return personHouseMapper.updatePersonHouse(personHouse);
    }

    /**
     * 批量删除房产信息
     * 
     * @param ids 需要删除的房产信息主键
     * @return 结果
     */
    @Override
    public int deletePersonHouseByIds(String ids)
    {
        return personHouseMapper.deletePersonHouseByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除房产信息信息
     * 
     * @param id 房产信息主键
     * @return 结果
     */
    @Override
    public int deletePersonHouseById(Long id)
    {
        return personHouseMapper.deletePersonHouseById(id);
    }
}
